<?php
class StudentService extends ServiceAbstract {
	
	public $_mapper;
	
	public function __construct(){

		$this->_mapper = new Db_Mapper_Student();
		
	}	
	
	public function fetchStudentsByIDTridy(){
		
		$ID_tr = (int)$this->getParam('ID_tr');
				
		$select = $this->_mapper->getTable()->select();
		$select->setIntegrityCheck(false)
		->from('Student',array())
		->columns(array('ID_st','Jmeno','Prijmeni','Login','Heslo'))
		->join('Student_has_Tridy','Student_has_Tridy.Student_ID_st = Student.ID_st',array())
		->where('Student_has_Tridy.Tridy_ID_tr = ?',$ID_tr)
		->order('Student.Prijmeni');

		echo $this->toXml($this->_mapper->fetchAll($select));
		
	}

}

?>